﻿var HistoryRecord = {};
HistoryRecord.showHisDetaildiv = function (e) {
    var keyid = $(e).attr("keyid");
    var url = "/property/property-follow-histories-paged?keyid=" + keyid;
    $.dialog({
        id: "dialogHistoryFollow",
        lock: true,
        title: "历史跟进",
        width: 600,
        heigth: 600,
        content: "<iframe frameborder='0' id='tabmenuiframe' scrolling='yes' allowtransparency='yes' width='600px' height='490px' src='" + url + "' />"
    });
}
HistoryRecord.showPriceHisDetaildiv = function (e) {
    var keyid = $(e).attr("keyid");
    var url = "/property/property-price-histories-ajax?keyid=" + keyid;
    $.ajax({
        url: url,
        success: function (data) {
            if (data.length > 0) {
                var temtr = "";
                for (i = 0; i < data.length; i++) {
                    temtr += "<tr><td>" + data[i].PriceCategoryformat + "</td><td>" + data[i].CreateTimeFromat + "</td><td>" + data[i].OriginalPriceFromat + "</td><td>" + data[i].ChangeRateFormat + "</td><td>" + data[i].FinalPriceFromat + "</td><td>" + data[i].ChangeUser + "</td></tr>";
                }
                var temhtml = "<table class='data-table mt10'><tbody><tr><th>叫价类型</th><th>叫价日期</th><th>调整前</th><th>调整比例</th><th>调整后</th><th>调价人</th></tr>" + temtr + "</tbody></table>";
                $.dialog({
                    id: "dialogHistoryFollow",
                    lock: true,
                    title: "价格变动",
                    content: temhtml
                });
            }
            else {
                $.dialog({
                    id: "dialogHistoryFollow",
                    lock: true,
                    title: "价格变动",
                    width: 160,
                    content: "暂无记录"
                });
            }
        },
        error: function (e) { }
    });
}

HistoryRecord.showTelHisDetaildiv = function (e) {
    var keyid = $(e).attr("keyid");
    var url = "/property/property-trustor-histories-ajax?keyid=" + keyid;
    $.ajax({
        url: url,
        success: function (data) {
            if (data.length > 0) {
                var temtr = "";
                for (i = 0; i < data.length; i++) {
                    temtr += "<tr><td>" + data[i].TrustorName + "</td><td>" + data[i].TrustorType + "</td><td>" + data[i].Mobile + "</td><td>" + data[i].CreateTimeFormat + "</td><td>" + data[i].Creator + "</td></tr>";
                }
                var temhtml = "<table class='data-table'><tbody><tr><th>联系人</th><th>类型</th><th>联系方式</th><th>录入时间</th><th>录入人</th></tr>" + temtr + "</tbody></table>";
                $.dialog({
                    id: "dialogHistoryFollow",
                    lock: true,
                    title: "业主电话",
                    content: temhtml
                });
            }
            else {
                $.dialog({
                    id: "dialogHistoryFollow",
                    lock: true,
                    title: "业主电话",
                    width: 160,
                    content: "暂无记录"
                });
            }
        },
        error: function (e) { }
    });
}

HistoryRecord.showPerformanceHisDetaildiv = function (e) {
    var keyid = $(e).attr("keyid");
    var url = "/Property/performance-history-list";
    $.AjaxAgency(url, { 'keyid': keyid }, function (data) {
        if (data.length > 0) {
            var temtr = "";
            for (i = 0; i < data.length; i++) {
                //temtr += "<tr><td>" + data[i].SysParameterItemName + "</td><td>" + data[i].RateFormat + "</td><td>" + data[i].PerformanceUserName + "</td><td>" + data[i].PerformanceDepartmentName + "</td><td>" + data[i].CreateUserName + "</td><td>" + data[i].CreateTimeFormat + "</td></tr>";
                temtr += "<tr><td>" + data[i].SysParameterItemName + "</td><td>" + data[i].PerformanceUserName + "</td><td>" + data[i].PerformanceDepartmentName + "</td><td>" + data[i].CreateUserName + "</td><td>" + data[i].CreateTimeFormat + "</td></tr>";
            }
            //var temhtml = "<table class='data-table'><tbody><tr><th>分成说明</th><th>分成比例</th><th>分成人</th><th>部门</th><th>登记人</th><th>登记时间</th></tr>" + temtr + "</tbody></table>";
            var temhtml = "<table class='data-table'><tbody><tr><th>分成说明</th><th>分成人</th><th>部门</th><th>登记人</th><th>登记时间</th></tr>" + temtr + "</tbody></table>";
            $.dialog({
                id: "dialogHistoryFollow",
                lock: true,
                title: "业绩声明",
                content: temhtml
            });
        }
        else if (data.length == 0) {
            $.dialog({
                id: "dialogHistoryFollow",
                lock: true,
                title: "业绩声明",
                width: 160,
                content: "暂无记录"
            });
        }
        else {
            $.dialog({
                id: "dialogHistoryFollow",
                lock: true,
                title: "业绩声明",
                content: data
            });
        }
    });
}

HistoryRecord.showRealSurveyHistorydiv = function(e) {
    var keyid = $(e).attr("keyid");
    var url = "/Property/realSurvey-history-list";
    $.AjaxAgency(url, { 'keyid': keyid }, function (data) {
        if (data.length > 0) {
            var temtr = "";
            for (i = 0; i < data.length; i++) {
                temtr += "<tr><td>" + data[i].RealSurveyPerson + "</td><td>" + data[i].DepartmentName + "</td><td>" + data[i].RealSurveyTime + "</td><td>" + data[i].AuditStatuText + "</td></tr>";
            }
            var temhtml = "<table class='data-table mt10'><tbody><tr><th>实勘人</th><th>实勘人部门</th><th>实勘时间</th><th>实勘状态</th></tr>" + temtr + "</tbody></table>";
            $.dialog({
                id: "dialogHistoryFollow",
                lock: true,
                title: "历史实勘",
                content: temhtml
            });
        }
        else {
            $.dialog({
                id: "dialogHistoryFollow",
                lock: true,
                title: "历史实勘",
                width: 160,
                content: "暂无记录"
            });
        }
    });
}

HistoryRecord.beginSearch = function () {
}
HistoryRecord.pageOnSuccessFun = function () {
}
HistoryRecord.init = function () { }